const innerButtons = {
  add: {
    text: '添加',
    type: 'danger',
    handler: ({ tableContext: { setAddFormVisiable } }) => setAddFormVisiable(true)
  },
  remove: {
    text: '删除',
    handler: () => alert(`删除`)
  }
}

module.exports =  function setButtons({ buttons = [] }, result) {
  if (buttons.length && result && !result.buttons) {
    result.buttons = []
  }
  buttons.forEach((btn) => {
    if (innerButtons[btn]) {
      result.buttons.push(innerButtons[btn])
    }
  })
}
